package com.PVZ.model.plant;

import com.PVZ.model.Entity;
import com.PVZ.model.bullet.Bullet;
import com.PVZ.model.emuns.Configs;
import com.PVZ.model.emuns.EffectType;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.emuns.PlantType;
import com.PVZ.model.weapon.Weapon;
import lombok.*;

import java.awt.*;
import java.util.Objects;

/**
 * Created by @Author: kabuda on @Date: 2021/5/18 19:27
 */
@Setter
@Getter
@NoArgsConstructor
public abstract class Plant extends Entity {
    private int price;


    private PlantType plantType;
    public Plant(PlantType plantType, Point point, MoveType moveType){
        super(point,moveType);
        this.health = Configs.plantHealth.get(plantType);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }


    public Plant(PlantType plantType,int row,int col,MoveType moveType){
        super(row,col,moveType);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }


    public Plant(PlantType plantType,MoveType moveType){
        super(moveType);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }
    public Plant(PlantType plantType, Point point){
        super(point,MoveType.Stop);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }


    public Plant(PlantType plantType,int row,int col){
        super(row,col,MoveType.Stop);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }


    public Plant(PlantType plantType){
        super(MoveType.Stop);
        this.plantType = plantType;
        this.health = Configs.plantHealth.get(this.plantType);
    }

    /**
     * 设置武器
     */
    public void setWeapon(Bullet bullet, EffectType effect, int coolDown, int attackFiled){
        Weapon weapon = new Weapon(bullet, effect, coolDown, attackFiled);
        this.setWeapon(weapon);
    };

    @Override
    public void setWeapon(Weapon weapon){
        super.setWeapon(weapon);
    }

    @Override
    public boolean equals(Object o) {
        return super.equals(o);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), anime);
    }
}
